import React, { useEffect } from 'react';
import { PlusOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer } from 'antd';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import FilterSearch from '@/components/FilterSearch';
import TableList from '@/components/TableList';
import { timeFormat } from '@/utils/common';
import { Link } from 'umi';

const VisitList = ({ location }) => {
  const { mark_user } = location.query;
  const columns = [
    {
      title: '页面',
      dataIndex: 'url_path',
    },
    {
      title: '用户id',
      dataIndex: 'user_id',
    },
    {
      title: '时间',
      dataIndex: 'create_time',
    },
  ];
  const dataRender = (list) => {
    return list.map((item) => {
      item.create_time = timeFormat(new Date(item.create_time));
      item.duration = item.duration + ' ms';
      return item;
    });
  };
  return (
    <PageContainer>
      <TableList
        post
        rowKey="id"
        columns={columns}
        source="/api/monitor/admin/visit-list"
        dataRender={dataRender}
        params={{ mark_user }}
      />
    </PageContainer>
  );
};

export default VisitList;
